package com.zs.games.exception;


import com.zs.games.resultTool.ResultCodeEnum;

/**
 * @title:
 * @author: LiChao
 * @dateTime: 2019/11/30 15:03
 * @description:
 **/
public class ImServiceException extends RuntimeException {

    private static final long serialVersionUID = 2359767895161832954L;

    private final ResultCodeEnum resultCode;

    public ImServiceException(String message) {
        super(message);
        this.resultCode = ResultCodeEnum.FAIL;
    }

    public ImServiceException(ResultCodeEnum codeEnum) {
        super(codeEnum.getCodeMsg());
        this.resultCode = codeEnum;
    }

    public ImServiceException(ResultCodeEnum codeEnum, String message) {
        super(message);
        this.resultCode = codeEnum;
    }

    public ImServiceException(ResultCodeEnum codeEnum, Throwable cause) {
        super(cause);
        this.resultCode = codeEnum;
    }

    public ResultCodeEnum getResultCode() {
        return this.resultCode;
    }

    public Long getResultCodeInt(){
        return this.resultCode.getCode();
    }

    public String getResultMessage(){
        return this.resultCode.getMessage();
    }


}
